package com.heima.search.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.dtos.HistorySearchDto;
import com.heima.model.search.dtos.UserSearchDto;
import com.heima.search.service.ApUserSearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * author Link
 *
 * @version 1.0
 * @date 2025/4/14  18:58
 */
@RestController
@RequestMapping("/api/v1/history")
@Slf4j
public class ApUserSearchController {

    @Autowired
    ApUserSearchService apUserSearchService;

    /**
     * 加载搜索历史
     * @return
     */
    @PostMapping("/load")
    public ResponseResult load() {
        log.info("加载搜索历史");
        return apUserSearchService.load();
    }

    /**
     * 删除搜索历史
     * @param historySearchDto
     */
    @PostMapping("/del")
    public ResponseResult del(@RequestBody HistorySearchDto historySearchDto){
        log.info("删除搜索历史：{}",historySearchDto);
        return apUserSearchService.del(historySearchDto);
    }

}
